import { createRouter, createWebHashHistory } from 'vue-router'
import Login from '@/views/user/Login.vue'
import Register from '@/views/user/Register.vue'
import Home from '@/views/home/Home.vue'


const router = createRouter({
  history: createWebHashHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: "/home",
    },
    {
      path: '/home',
      component: Home
    },
    {
      path: '/home',
      component: Home,
      children: [
        {
          path: '/updatePassword',
          // 路由的懒加载
          component: () => import("@/views/user/UpdatePassword.vue")
        },
        {
          path: "/residentInfo",
          component: () => import("@/views/residentInfo/ResidentInfo.vue")
        },
        {
          path: "/healthRecord",
          component: () => import("@/views/healthRecord/HealthRecord.vue")
        },
        {
          path: "/medicalHistory",
          component: () => import("@/views/medicalHistory/MedicalHistory.vue")
        },
        {
          path: "/medication",
          component: () => import("@/views/medication/Medication.vue")
        },
        {
          path: "/appointment",
          component: () => import("@/views/appointment/Appointment.vue")
        },
        {
          path: "/healthInstitution/:id",
          component: () => import("@/views/appointment/HealthInstitution.vue")
        },
        {
          path: "/moreHealthInstitutions",
          component: () => import("@/views/appointment/MoreHealthInstitutions.vue")
        },
        {
          path: "/appointmentRecords",
          component: () => import("@/views/appointmentRecords/AppointmentRecords.vue")
        },
        {
          path: "/orderRecords",
          component: () => import("@/views/orderRecords/OrderRecords.vue")
        },
        {
          path: "/evaluate/:doctorId",
          component: () => import("@/views/evaluate/Evaluate.vue")
        }
      ]
    },
    {
      path: '/login',
      component: Login
    },
    {
      path: '/register',
      component: Register
    },
  ]
})

export default router
